package com.blankii.androidlibrary.utils

import java.text.DecimalFormat
import java.text.NumberFormat

/**
 * author: blankii
 * created on: 2024/4/29 11:02
 * description:数据类型处理类
 */
object DataTypeUtils {
    /**
     * Double 保留一位小数
     */
    fun changeFloatToPointOne(dou: Float): Float {
        var dou = dou
        val nf: NumberFormat = DecimalFormat("0.0")
        dou = nf.format(dou).toFloat()
        return dou
    }
    fun changeDoubleToPointOne(dou: Double): Double {
        var dou = dou
        val nf: NumberFormat = DecimalFormat("0.0")
        dou = nf.format(dou).toDouble()
        return dou
    }
}